import sched
import time


def print_event(name):
    print('Event：', time.time(), name)


now = time.time()
print('START:', now)

sche = sched.scheduler(time.time, time.sleep)
# 优先级小的先执行，enterabs 与 enter 的区别在于 enterabs 指定的为精确时间
sche.enterabs(now + 2, 2, print_event, ('first',))
sche.enterabs(now + 2, 1, print_event, ('second',))

# 运行调度器
sche.run()
